package com.example.demo.service.impl;

import com.example.demo.entity.vo.Statistic;
import com.example.demo.mapper.StatisticsMapper;
import com.example.demo.service.StatisticsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author liye
 * @date 2025/10/10 10:53
 * @description:
 */
@Service
public class StatisticsServiceImpl implements StatisticsService {
    @Resource
    private StatisticsMapper statisticsMapper;
    @Override
    public  HashMap<String, Object[]> areaCountDoctor() {
        List<Statistic> statisticList=statisticsMapper.areaCountDoctor();
        //专门记录医院的名称
        String []  hospitalName=new String[statisticList.size()];
        //专门记录医院的医生人数
        Integer [] doctorCount=new Integer[statisticList.size()];
        for (int i = 0; i <statisticList.size() ; i++) {
            hospitalName[i]=statisticList.get(i).getName();
            doctorCount[i]=statisticList.get(i).getValue();
        }
        HashMap<String, Object[]> map=new HashMap<>();
        map.put("hospitalName",hospitalName);
        map.put("doctorCount",doctorCount);

        return map;
    }

    @Override
    public List<Statistic> areaCountDept() {
        List<Statistic> statisticList=statisticsMapper.areaCountDept();
        return statisticList;
    }

}
